package com.lhg.juc;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class test4 {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            log.debug("启动，并睡眠。。。");
            try {
                Thread.sleep(2000);
                log.debug("结束");
            } catch (InterruptedException e) {
                log.debug("被打断了");
                e.printStackTrace();
            }
        });
        thread.setName("t1");
        thread.start();
        log.debug("thread state:{}",thread.getState());
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.debug("thread state:{}",thread.getState());

        thread.interrupt();

    }
}
